/*package GUI;

import IA.SystemClock;
import Simulation.CustomerSimulator;
import Simulation.KitchenSimulator;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import system_interface.SystemInterface;
import IA.*;
//Radio buttons to instantiate correct preptime strategy
//   kitchen.setCookStrategy(new ChronologicalCookStrategy());

// @author Rob Leister rleist1@students.towson.edu
public class SimulatorGUI extends javax.swing.JFrame {

    private JLabel jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8;
    private JSpinner jSpinner1, jSpinner2, jSpinner3, jSpinner4, jSpinner5, jSpinner6, jSpinner7;
    private JFormattedTextField jReductField;
    private JButton jButton1, jButton2;
    private JToggleButton jToggleButton1;
    private JRadioButton chronoRadButton, highestRadButton, lowestRadButton, similarRadButton;
    SystemInterface si;
    KitchenSimulator kitchen;
    CustomerSimulator hostess;
    InformationAggregator ia;
    List<ManagersGUI> mangui = new ArrayList<ManagersGUI>();
    newManagerGUI mgui;
    private final int DEFAULT_NUM_SERVERS = 5;

    public void update() {
        this.repaint();
    }

    public SimulatorGUI() {
        initComponents();
    }

    public SimulatorGUI(SystemInterface s, CustomerSimulator m, KitchenSimulator k, InformationAggregator ia) {
        initComponents();
        this.ia = ia;
        si = s;
        hostess = m;
        kitchen = k;
        ia.getServerCollection().setNumServers(DEFAULT_NUM_SERVERS, k.getObservableInstance());
        jSpinner1.setValue(Integer.parseInt(si.getNumberOfTables()));
        jSpinner2.setValue(hostess.getMinEatTime());
        jSpinner3.setValue(hostess.getArrivalDelay());
        jSpinner4.setValue(kitchen.getGrillCapacity());
        jSpinner5.setValue(SystemClock.getTimeScale());
        jSpinner6.setValue(hostess.getMaxEatTime());
        jSpinner7.setValue(ia.getServerCollection().getNumServers());
        jReductField.setValue(kitchen.getTimeReductionFactor());

        ActionListener refresh = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                update();
            }
        };
        new javax.swing.Timer(1000, refresh).start();
    } // end SimulationGUI(si) constructor

    private void initComponents() {
        jLabel1 = new JLabel();
        jLabel2 = new JLabel();
        jLabel3 = new JLabel();
        jLabel4 = new JLabel();
        jLabel5 = new JLabel();
        jLabel6 = new JLabel();
        jLabel7 = new JLabel();
        jLabel8 = new JLabel();
        jSpinner1 = new JSpinner();
        jSpinner2 = new JSpinner();
        jSpinner3 = new JSpinner();
        jSpinner4 = new JSpinner();
        jSpinner5 = new JSpinner();
        jSpinner6 = new JSpinner();
        jSpinner7 = new JSpinner();
        jToggleButton1 = new JToggleButton();
        jButton1 = new JButton();
        jButton2 = new JButton();
        jReductField = new JFormattedTextField();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Simulation Control");
        setAlwaysOnTop(true);
        jLabel1.setText("Number of Tables");
        jLabel2.setText("Minimum Eat Time");
        jLabel3.setText("Customer Arrival Delay");
        jLabel4.setText("Grill Capacity");
        jLabel5.setText("Clock Rate");
        jLabel6.setText("Reduction Factor");
        jLabel7.setText("Maximum Eat Time");
        jLabel8.setText("Number of Servers");
        jToggleButton1.setText("Start/Stop");
        jButton1.setText("Add Manager GUI");
        chronoRadButton = new JRadioButton("Chronological");
        highestRadButton = new JRadioButton("Highest");
        lowestRadButton = new JRadioButton("Lowest");
        similarRadButton = new JRadioButton("Similar");

        jButton1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                mangui.add(new ManagersGUI(si, hostess, kitchen));
                mangui.get(mangui.size() - 1).setVisible(true);
            }// end override
        });// end JButton1
        jButton2.setText("Add Four in One GUI");

        jButton2.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                mgui = new newManagerGUI(si, kitchen, hostess);
                mgui.setVisible(true);
            }// end override
        });// end JButton2

        jReductField.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Double d = Double.parseDouble(jReductField.getText());
                kitchen.setTimeReductionFactor(d);
            }// end override
        });// end jReductField

        jSpinner1.setModel(new SpinnerNumberModel(1, 1, 50, 1));
        jSpinner1.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                si.setNumberOfTables(jSpinner1.getValue().toString());
            } // end stateChanged
        }); //end JSPinner1 addChangeListener

        jSpinner2.setModel(new SpinnerNumberModel(1, 1, 100, 1));
        jSpinner2.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                hostess.setMinEatTime(Integer.parseInt(jSpinner2.getValue().toString()));
            } // end stateChanged
        });  //end JSPinner2 addChangeListener

        jSpinner3.setModel(new SpinnerNumberModel(1, 1, 50, 1));
        jSpinner3.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                hostess.setArrivalDelay((Integer) jSpinner3.getValue());
            } // end stateChanged
        });  //end JSPinner3 addChangeListener

        jSpinner4.setModel(new SpinnerNumberModel(1, 1, 50, 1));
        jSpinner4.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                kitchen.setGrillCapacity((Integer) jSpinner4.getValue());
            } // end stateChanged
        });  //end JSPinner4 addChangeListener

        jSpinner5.setModel(new SpinnerNumberModel(IA.SystemClock.getTimeScale(), 10, 9000000, 1000));
        jSpinner5.addChangeListener(
                new ChangeListener() {

                    @Override
                    public void stateChanged(ChangeEvent evt) {
                        SystemClock.setTimeScale((Integer) jSpinner5.getValue());
                    } // end stateChanged
                });  //end JSPinner5 addChangeListener

        jSpinner6.setModel(new SpinnerNumberModel(1, 1, 200, 1));
        jSpinner6.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                hostess.setMaxEatTime(Integer.parseInt(jSpinner6.getValue().toString()));
            } // end stateChanged
        });  //end JSPinner6 addChangeListener

        jSpinner7.setModel(new SpinnerNumberModel(1, 1, 100, 1));
        jSpinner7.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                ia.getServerCollection().setNumServers(Integer.parseInt(jSpinner7.getValue().toString()), kitchen.getObservableInstance());
            } // end stateChanged
        });  //end JSPinner7 addChangeListener

        jToggleButton1.addActionListener(
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        if (SystemClock.getInstance().isRunning()) {
                            SystemClock.getInstance().setRunning(false);
                        } else {
                            SystemClock.getInstance().setRunning(true);
                        }
                    }// end actionPerformed
                }); // end JToggleButton1 addActionListener
        chronoRadButton.setSelected(true);
        chronoRadButton.setActionCommand("Chronological");
        highestRadButton.setActionCommand("Highest");
        lowestRadButton.setActionCommand("Lowest");
        similarRadButton.setActionCommand("Similar");
        chronoRadButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                //instantiate chronological
            }// end action performed
        });
        highestRadButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                //instantiate highest
            }// end action performed
        });
        lowestRadButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                //instantiate lowest
            }// end action performed
        });
        similarRadButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                //instantiate similar
            }// end action performed
        });
        ButtonGroup buttonGroup = new ButtonGroup();
        buttonGroup.add(chronoRadButton);
        buttonGroup.add(highestRadButton);
        buttonGroup.add(lowestRadButton);
        buttonGroup.add(similarRadButton);
        GroupLayout layout = new GroupLayout(getContentPane());

        getContentPane().setLayout(layout);
        layout.setAutoCreateGaps(
                true);
        layout.setHorizontalGroup(
                layout.createSequentialGroup() //
                .addGap(20)//
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) //
                .addGroup(layout.createSequentialGroup() //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) //
                .addComponent(jLabel4)// 
                .addComponent(jLabel8)// 
                .addComponent(jLabel3)//
                .addComponent(jLabel2)//
                .addComponent(jLabel7)//
                .addComponent(jLabel1)//
                .addComponent(jLabel5) //
                .addComponent(jLabel6) //
                .addGap(20) //
                )// end Label Group
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) //
                .addComponent(jSpinner1, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner7, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner2, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner6, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner3, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner4, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner5, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jReductField, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addGap(20)//
                ) // End Spinner Group
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) //
                .addComponent(chronoRadButton)//
                .addComponent(highestRadButton)//
                .addComponent(lowestRadButton)//
                .addComponent(similarRadButton)//
                ) // End Radio Buttons
                ) // End Sequential
                .addGap(20)//
                .addComponent(jButton2, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) //
                .addComponent(jButton1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) //
                .addComponent(jToggleButton1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) //
                ).addGap(20)//
                ); //

        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
                .addGroup(layout.createSequentialGroup() //
                .addContainerGap() //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) //
                .addComponent(chronoRadButton) //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel8, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner7, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                         .addComponent(highestRadButton)//
                ) // 
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner2, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                         .addComponent(lowestRadButton)//
) // 
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner6, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                         .addComponent(similarRadButton)//

                ) // 
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) // 
                .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner3, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                ) //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel4, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner4, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)//
                ) // 
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel5, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) // 
                .addComponent(jSpinner5, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)//
                ) // 
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) // 
                .addComponent(jReductField, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)//
                ) // 
                .addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jToggleButton1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addContainerGap() //
                )// end sequential
                );

        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel1, jSpinner1, chronoRadButton
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel8, jSpinner7, highestRadButton
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel2, jSpinner2, lowestRadButton
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel3, jSpinner3, similarRadButton
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel4, jSpinner4
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel5, jSpinner5
                });

        pack();
    } // end init components

    public static void main(String args[]) {
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;


                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new GUI.SimulatorGUI().setVisible(true);
            }
        });
    }
} // End Class Simulator



package GUI;

import IA.SystemClock;
import Simulation.CustomerSimulator;
import Simulation.KitchenSimulator;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import system_interface.SystemInterface;
import IA.*;
//Radio buttons to instantiate correct preptime strategy
//   kitchen.setCookStrategy(new ChronologicalCookStrategy());

// @author Rob Leister rleist1@students.towson.edu
public class SimulatorGUI extends javax.swing.JFrame {

    private JLabel jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8;
    private JSpinner jSpinner1, jSpinner2, jSpinner3, jSpinner4, jSpinner5, jSpinner6, jSpinner7;
    private JFormattedTextField jReductField;
    private JButton jButton1;
    private JToggleButton jToggleButton1;
    SystemInterface si;
    KitchenSimulator kitchen;
    CustomerSimulator hostess;
    InformationAggregator ia;
    List<ManagersGUI> mangui = new ArrayList<ManagersGUI>();
    newManagerGUI mgui;

    private final int DEFAULT_NUM_SERVERS = 5;
    
    
    public void update() {
        this.repaint();
    }

    public SimulatorGUI() {
        initComponents();
    }

    public SimulatorGUI(SystemInterface s, CustomerSimulator m, KitchenSimulator k, InformationAggregator ia) {
        initComponents();
        this.ia = ia;
        si = s;
        hostess = m;
        kitchen = k;
        ia.getServerCollection().setNumServers(DEFAULT_NUM_SERVERS, k.getObservableInstance());
        jSpinner1.setValue(Integer.parseInt(si.getNumberOfTables()));
        jSpinner2.setValue(hostess.getMinEatTime());
        jSpinner3.setValue(hostess.getArrivalDelay());
        jSpinner4.setValue(kitchen.getGrillCapacity());
        jSpinner5.setValue(SystemClock.getTimeScale());
        jSpinner6.setValue(hostess.getMaxEatTime());
        jSpinner7.setValue(ia.getServerCollection().getNumServers());
        jReductField.setValue(kitchen.getTimeReductionFactor());

        ActionListener refresh = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                update();
            }
        };
        new javax.swing.Timer(1000, refresh).start();
    } // end SimulationGUI(si) constructor


    private void initComponents() {
        jLabel1 = new JLabel();
        jLabel2 = new JLabel();
        jLabel3 = new JLabel();
        jLabel4 = new JLabel();
        jLabel5 = new JLabel();
        jLabel6 = new JLabel();
        jLabel7 = new JLabel();
        jLabel8 = new JLabel();
        jSpinner1 = new JSpinner();
        jSpinner2 = new JSpinner();
        jSpinner3 = new JSpinner();
        jSpinner4 = new JSpinner();
        jSpinner5 = new JSpinner();
        jSpinner6 = new JSpinner();
        jSpinner7 = new JSpinner();
        jToggleButton1 = new JToggleButton();
        jButton1 = new JButton();
        jReductField = new JFormattedTextField();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Simulation Control");
        setAlwaysOnTop(true);
        jLabel1.setText("Number of Tables");
        jLabel2.setText("Minimum Eat Time");
        jLabel3.setText("Customer Arrival Delay");
        jLabel4.setText("Grill Capacity");
        jLabel5.setText("Clock Rate");
        jLabel6.setText("Reduction Factor");
        jLabel7.setText("Maximum Eat Time");
        jLabel8.setText("Number of Servers");
        jToggleButton1.setText("Start/Stop");
        jButton1.setText("Add Manager GUI");

        jButton1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                mangui.add(new ManagersGUI(si, hostess, kitchen));
                mangui.get(mangui.size()-1).setVisible(true);
                mgui = new newManagerGUI(si,kitchen,hostess);
                mgui.setVisible(true);
            }// end override
        });// end JButton1

        jReductField.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Double d = Double.parseDouble(jReductField.getText());
                kitchen.setTimeReductionFactor(d);
            }// end override
        });// end jReductField

        jSpinner1.setModel(new SpinnerNumberModel(1, 1, 50, 1));
        jSpinner1.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                si.setNumberOfTables(jSpinner1.getValue().toString());
            } // end stateChanged
        }); //end JSPinner1 addChangeListener

        jSpinner2.setModel(new SpinnerNumberModel(1, 1, 100, 1));
        jSpinner2.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                hostess.setMinEatTime(Integer.parseInt(jSpinner2.getValue().toString()));
            } // end stateChanged
        });  //end JSPinner2 addChangeListener

        jSpinner3.setModel(new SpinnerNumberModel(1, 1, 50, 1));
        jSpinner3.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                hostess.setArrivalDelay((Integer) jSpinner3.getValue());
            } // end stateChanged
        });  //end JSPinner3 addChangeListener

        jSpinner4.setModel(new SpinnerNumberModel(1, 1, 50, 1));
        jSpinner4.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                kitchen.setGrillCapacity((Integer) jSpinner4.getValue());
            } // end stateChanged
        });  //end JSPinner4 addChangeListener

        jSpinner5.setModel(new SpinnerNumberModel(IA.SystemClock.getTimeScale(), 10, 9000000, 1000));
        jSpinner5.addChangeListener(
                new ChangeListener() {

                    @Override
                    public void stateChanged(ChangeEvent evt) {
                        SystemClock.setTimeScale((Integer) jSpinner5.getValue());
                    } // end stateChanged
                });  //end JSPinner5 addChangeListener

        jSpinner6.setModel(new SpinnerNumberModel(1, 1, 200, 1));
        jSpinner6.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                hostess.setMaxEatTime(Integer.parseInt(jSpinner6.getValue().toString()));
            } // end stateChanged
        });  //end JSPinner6 addChangeListener

        jSpinner7.setModel(new SpinnerNumberModel(1, 1, 100, 1));
        jSpinner7.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                ia.getServerCollection().setNumServers(Integer.parseInt(jSpinner7.getValue().toString()), kitchen.getObservableInstance());
            } // end stateChanged
        });  //end JSPinner7 addChangeListener

        jToggleButton1.addActionListener(
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        if (SystemClock.getInstance().isRunning()) {
                            SystemClock.getInstance().setRunning(false);
                        } else {
                            SystemClock.getInstance().setRunning(true);
                        }
                    }// end actionPerformed
                }); // end JToggleButton1 addActionListener



        GroupLayout layout = new GroupLayout(getContentPane());

        getContentPane().setLayout(layout);
        layout.setAutoCreateGaps(
                true);
        layout.setHorizontalGroup(
                layout.createSequentialGroup() //
                .addGap(20)//
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) //
                .addGroup(layout.createSequentialGroup() //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) //
                .addComponent(jLabel4)// 
                .addComponent(jLabel8)// 
                .addComponent(jLabel3)//
                .addComponent(jLabel2)//
                .addComponent(jLabel7)//
                .addComponent(jLabel1)//
                .addComponent(jLabel5) //
                .addComponent(jLabel6) //
                .addGap(20) //
                )// end Label Group
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) //
                .addComponent(jSpinner1, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner7, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner2, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner6, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner3, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner4, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner5, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jReductField, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) //
                .addGap(20)//
                ) // End Spinner Group
                ) // End Sequential
                .addGap(20)//
                .addComponent(jButton1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) //
                .addComponent(jToggleButton1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) //
                ).addGap(20)//
                ); //

        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
                .addGroup(layout.createSequentialGroup() //
                .addContainerGap() //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel8, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner7, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                ) // 
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner2, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                ) // 
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner6, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                ) // 
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) // 
                .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner3, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                ) //
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel4, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jSpinner4, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)//
                ) // 
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel5, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) // 
                .addComponent(jSpinner5, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)//
                ) // 
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) //
                .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) // 
                .addComponent(jReductField, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)//
                ) // 
                .addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addComponent(jToggleButton1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) //
                .addContainerGap() //
                )//
                );

        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel1, jSpinner1
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel8, jSpinner7
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel2, jSpinner2
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel3, jSpinner3
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel4, jSpinner4
                });
        layout.linkSize(SwingConstants.VERTICAL,
                new java.awt.Component[]{jLabel5, jSpinner5
                });

        pack();
    } // end init components

    public static void main(String args[]) {
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;


                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUI.SimulatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new GUI.SimulatorGUI().setVisible(true);
            }
        });
    }
} // End Class SimulatorGUI
* 
* */